package com.znow.admin.system.security.model.dto;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.compress.utils.Lists;
import org.springframework.security.core.GrantedAuthority;

import java.util.List;

/**
 * 权限dto
 *
 * @author Administrator
 * @date 2022/10/26
 */
@Data
public class PermissionsTreeDTO implements GrantedAuthority {

    @ApiModelProperty("权限ID")
    private Long permissionId;

    @ApiModelProperty("权限名称")
    private String permissionName;

    @ApiModelProperty("权限类型")
    private Long permissionType;

    @ApiModelProperty("权限code")
    private String permissionCode;

    @ApiModelProperty("权限icon")
    private String permissionIcon;

    @ApiModelProperty("组件路径")
    private String componentPath;

    @ApiModelProperty("组件名称")
    private String componentName;

    @ApiModelProperty("路径")
    private String url;

    private Integer level = 0;

    @ApiModelProperty("父节点ID")
    private Long parentId;

    @ApiModelProperty("孩子节点")
    private List<PermissionsTreeDTO> children = Lists.newArrayList();

    @Override
    public String getAuthority() {
        return permissionCode;
    }
}
